.class public Lcom/htc/android/footprints/view/HorizontalScrollView;
.super Landroid/widget/ScrollView;
.source "HorizontalScrollView.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "HorizontalScrollView"


# instance fields
.field private currentX:F

.field private currentY:F

.field private mGesture:Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;

.field private mIsBeingDraggedX:Z

.field private mIsBeingDraggedY:Z

.field private mLastMotionX:F

.field private mLastMotionY:F

.field private mTouchSlopX:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 2
    .parameter "context"

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 26
    invoke-direct {p0, p1}, Landroid/widget/ScrollView;-><init>(Landroid/content/Context;)V

    .line 11
    iput-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    .line 12
    iput-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 15
    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentX:F

    .line 16
    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentY:F

    .line 17
    const/16 v0, 0xa

    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mTouchSlopX:I

    .line 27
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 2
    .parameter "context"
    .parameter "attrs"

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 30
    invoke-direct {p0, p1, p2}, Landroid/widget/ScrollView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 11
    iput-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    .line 12
    iput-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 15
    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentX:F

    .line 16
    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentY:F

    .line 17
    const/16 v0, 0xa

    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mTouchSlopX:I

    .line 31
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 2
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 35
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/ScrollView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 11
    iput-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    .line 12
    iput-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 15
    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentX:F

    .line 16
    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentY:F

    .line 17
    const/16 v0, 0xa

    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mTouchSlopX:I

    .line 36
    return-void
.end method

.method private viewSwitch()V
    .locals 4

    .prologue
    const-string v3, "HorizontalScrollView"

    .line 43
    iget v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentY:F

    iget v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionY:F

    sub-float/2addr v0, v1

    invoke-static {v0}, Ljava/lang/Math;->abs(F)F

    move-result v0

    const/high16 v1, 0x42c8

    cmpl-float v0, v0, v1

    if-lez v0, :cond_0

    .line 44
    const-string v0, "HorizontalScrollView"

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "viewSwitch, deltaY = "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentY:F

    iget v2, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionY:F

    sub-float/2addr v1, v2

    invoke-static {v1}, Ljava/lang/Math;->abs(F)F

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v3, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 60
    :goto_0
    return-void

    .line 48
    :cond_0
    iget v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentX:F

    iget v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionX:F

    cmpl-float v0, v0, v1

    if-lez v0, :cond_2

    .line 49
    iget-object v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mGesture:Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;

    if-eqz v0, :cond_1

    .line 50
    iget-object v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mGesture:Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;

    invoke-interface {v0}, Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;->moveRight()V

    .line 52
    :cond_1
    const-string v0, "HorizontalScrollView"

    const-string v0, "action right"

    invoke-static {v3, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 55
    :cond_2
    iget-object v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mGesture:Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;

    if-eqz v0, :cond_3

    .line 56
    iget-object v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mGesture:Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;

    invoke-interface {v0}, Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;->moveLeft()V

    .line 58
    :cond_3
    const-string v0, "HorizontalScrollView"

    const-string v0, "action left"

    invoke-static {v3, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method


# virtual methods
.method public onInterceptTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 8
    .parameter "ev"

    .prologue
    const/4 v6, 0x1

    const/4 v5, 0x0

    const-string v7, "HorizontalScrollView"

    .line 64
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v2

    .line 65
    .local v2, action:I
    const/4 v4, 0x2

    if-ne v2, v4, :cond_0

    iget-boolean v4, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    if-eqz v4, :cond_0

    move v4, v6

    .line 115
    :goto_0
    return v4

    .line 69
    :cond_0
    invoke-super {p0, p1}, Landroid/widget/ScrollView;->onInterceptTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v4

    iput-boolean v4, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 71
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v0

    .line 72
    .local v0, X:F
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v1

    .line 74
    .local v1, Y:F
    packed-switch v2, :pswitch_data_0

    .line 111
    :cond_1
    :goto_1
    iget-boolean v4, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    if-nez v4, :cond_2

    iget-boolean v4, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    if-eqz v4, :cond_3

    :cond_2
    move v4, v6

    .line 112
    goto :goto_0

    .line 77
    :pswitch_0
    iput v0, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionX:F

    .line 78
    iput v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionY:F

    .line 85
    iput-boolean v5, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    .line 86
    iput-boolean v5, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 88
    const-string v4, "HorizontalScrollView"

    const-string v4, "Intercept, ACTION_DOWN"

    invoke-static {v7, v4}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    .line 96
    :pswitch_1
    iget v4, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionX:F

    sub-float v4, v0, v4

    invoke-static {v4}, Ljava/lang/Math;->abs(F)F

    move-result v4

    float-to-int v3, v4

    .line 97
    .local v3, xDiff:I
    iget v4, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mTouchSlopX:I

    if-le v3, v4, :cond_1

    .line 98
    iput-boolean v6, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    goto :goto_1

    .line 105
    .end local v3           #xDiff:I
    :pswitch_2
    iput-boolean v5, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    .line 106
    iput-boolean v5, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 107
    const-string v4, "HorizontalScrollView"

    const-string v4, "Intercept, ACTION_UP"

    invoke-static {v7, v4}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    :cond_3
    move v4, v5

    .line 115
    goto :goto_0

    .line 74
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_2
        :pswitch_1
    .end packed-switch
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 5
    .parameter "ev"

    .prologue
    const/4 v3, 0x0

    const-string v4, "HorizontalScrollView"

    .line 121
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v0

    .line 123
    .local v0, action:I
    iget-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    if-nez v1, :cond_0

    .line 124
    invoke-super {p0, p1}, Landroid/widget/ScrollView;->onInterceptTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v1

    iput-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 130
    :goto_0
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v1

    iput v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentX:F

    .line 131
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v1

    iput v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentY:F

    .line 133
    packed-switch v0, :pswitch_data_0

    .line 158
    :goto_1
    :pswitch_0
    const/4 v1, 0x1

    return v1

    .line 127
    :cond_0
    invoke-super {p0, p1}, Landroid/widget/ScrollView;->onTouchEvent(Landroid/view/MotionEvent;)Z

    goto :goto_0

    .line 135
    :pswitch_1
    const-string v1, "HorizontalScrollView"

    const-string v1, "onTouch, ACTION_DOWN"

    invoke-static {v4, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    .line 149
    :pswitch_2
    iget-boolean v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    if-eqz v1, :cond_1

    iget v1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentX:F

    iget v2, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionX:F

    sub-float/2addr v1, v2

    invoke-static {v1}, Ljava/lang/Math;->abs(F)F

    move-result v1

    const/high16 v2, 0x4248

    cmpl-float v1, v1, v2

    if-lez v1, :cond_1

    .line 150
    invoke-direct {p0}, Lcom/htc/android/footprints/view/HorizontalScrollView;->viewSwitch()V

    .line 151
    iput-boolean v3, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedX:Z

    .line 152
    iput-boolean v3, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mIsBeingDraggedY:Z

    .line 154
    :cond_1
    const-string v1, "HorizontalScrollView"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onTouch, ACTION_UP, deltaX = "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget v2, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->currentX:F

    iget v3, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mLastMotionX:F

    sub-float/2addr v2, v3

    invoke-static {v2}, Ljava/lang/Math;->abs(F)F

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v4, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    .line 133
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_1
        :pswitch_2
        :pswitch_0
    .end packed-switch
.end method

.method public setGestureCallback(Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;)V
    .locals 0
    .parameter "gesture"

    .prologue
    .line 39
    iput-object p1, p0, Lcom/htc/android/footprints/view/HorizontalScrollView;->mGesture:Lcom/htc/android/footprints/view/HorizontalScrollView$Gesture;

    .line 40
    return-void
.end method
